#ifndef _KEYBOARD_H
#define _KEYBOARD_H

#include <dinput.h>
#include <d3d9.h>
#include <d3dx9.h>

#define KEY_DOWN(code) ( IsKeyDown(code) )
#define KEYBOARD_BUFFER_SIZE	1024

class CKeyboard
{
protected:
	LPDIRECTINPUT8       _di;		// The DirectInput object         
	LPDIRECTINPUTDEVICE8 _Keyboard;	// The keyboard device 
	HINSTANCE _hInstance;
	HWND _hWnd;
	BYTE  _KeyStates[256];			// DirectInput keyboard state buffer 

	// Buffered keyboard data
	DIDEVICEOBJECTDATA _KeyEvents[KEYBOARD_BUFFER_SIZE];
public:
	CKeyboard(void);
	~CKeyboard(void);
	void InitKeyboard(HINSTANCE hInstance, HWND hWnd);
	void ProcessKeyBoard();
	int IsKeyDown(int KeyCode);
	virtual void OnKeyDown(int KeyCode);
	virtual void OnKeyUp(int KeyCode);
	//virtual void ProcessInput(LPDIRECT3DDEVICE9 d3ddv, int Delta);
	virtual void ProcessInput();
};

#endif